import dayjs from "dayjs";
import { useEffect, useState } from "react";

export const IntervalDayjs = () => {
  const [intervalDayjs, setIntervalDayjs] = useState("");

  useEffect(() => {
    let timer = setInterval(() => {
      setIntervalDayjs(dayjs(new Date()).format("dddd YYYY-MM-DD HH：mm：ss"));
    }, 1000);

    return () => {
      clearInterval(timer);
    };
  }, []);

  return <>{intervalDayjs}</>;
};
